@extends('layouts.default')
@section('content')
	<div class="requests-filter">
		<div class="heading">Filtros</div>
		<div class="fields">
			<div class="from">
				<label class="label">Desde: </label><input type="date" />
			</div>
			<div class="to">
				<label class="label">Hasta: </label><input type="date" />
			</div>
			<div class="status">
				<label class="label">Estado: </label>
				<select>
					<option value="" selected>--</option>
				@foreach(ItemRequestStatus::all() as $status)
					<option value="{{$status->pk}}">{{$status->description}}</option>
				@endforeach
				</select>
			</div>
			<div class="controls">
				<a href="#">Buscar</a>
			</div>
		</div>
	</div>
	@if($requests->isEmpty())
	<p>No hay solicitudes para mostrar.</p>
	@else
	<table class="table" id="requests-table">
		<thead>
			<tr>
				<th>Fecha de creación</th>
				<th>Fecha de actualización</th>
				<th>Estado</th>
				<th colspan="3">Acciones</th>
			</tr>
		</thead>
		<tbody>
	     @foreach($requests as $request)
	     	<tr id="{{$request->pk}}">
	     		<td>{{$request->created_at}}</td>
	     		<td>{{$request->updated_at}}</td>
	     		<td>{{$request->requestStatus->description}}</td>
	     		<td><a class="btn items" href="#">Ver items</a></td>
	     	<tr>
	     @endforeach
     	</tbody>
     </table>
     {{$requests->links()}}
     @endif
     <div class="request-options">
     	<a href="#" class="btn create">Crear una solicitud</a>
     	<a href="#" class="btn request-new-item">Solicitar un nuevo item</a>
     </div>
     {{ HTML::style('css/popup.css'); }}
     <script type="text/javascript" src="js/Requests.js"></script>
@stop